package com.j256.ormlite.support;

import com.j256.ormlite.misc.SqlExceptionUtil;
import java.lang.reflect.Constructor;
import java.sql.SQLException;

public class ReflectionDatabaseConnectionProxyFactory
  implements DatabaseConnectionProxyFactory
{
  private final Constructor<? extends DatabaseConnection> constructor;
  private final Class<? extends DatabaseConnection> proxyClass;

  public ReflectionDatabaseConnectionProxyFactory(Class<? extends DatabaseConnection> paramClass)
    throws IllegalArgumentException
  {
    this.proxyClass = paramClass;
    try
    {
      this.constructor = paramClass.getConstructor(new Class[] { DatabaseConnection.class });
      return;
    }
    catch (Exception localException)
    {
    }
    throw new IllegalArgumentException("Could not find constructor with DatabaseConnection argument in " + paramClass);
  }

  public DatabaseConnection createProxy(DatabaseConnection paramDatabaseConnection)
    throws SQLException
  {
    try
    {
      DatabaseConnection localDatabaseConnection = (DatabaseConnection)this.constructor.newInstance(new Object[] { paramDatabaseConnection });
      return localDatabaseConnection;
    }
    catch (Exception localException)
    {
      throw SqlExceptionUtil.create("Could not create a new instance of " + this.proxyClass, localException);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.j256.ormlite.support.ReflectionDatabaseConnectionProxyFactory
 * JD-Core Version:    0.6.2
 */